package com.kevis.zhunblog.admin.customHtmlTag;

import com.kevis.zhunblog.service.PowerMenuService;
import com.kevis.zhunblog.service.RolePowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;

import java.util.HashSet;
import java.util.Set;

@Component
public class CustomTagHelper extends AbstractProcessorDialect {
    /**
     * 定义方言名称
     */
    private static final String NAME="系统自定义标签";

    /**
     * 定义方言属性
     */
    private static final String PREFIX="hhm";

//    @Autowired
//    private RedisTemplate redisTemplate;

    @Autowired
    private RolePowerService rolePowerService;

    @Autowired
    private PowerMenuService powerMenuService;

    protected CustomTagHelper() {
        super(NAME, PREFIX, StandardDialect.PROCESSOR_PRECEDENCE);
    }

    @Override
    public Set<IProcessor> getProcessors(String dialectPrefix) {
        final Set<IProcessor> processor=new HashSet<>();
        //<hhm:select>标签
//        processor.add(new CustomSecurityAction(PREFIX,redisTemplate,rolePowerService,powerMenuService));
        processor.add(new CustomSecurityAction(PREFIX,rolePowerService,powerMenuService));
        //processor.add(new CustomSecurityAction(PREFIX,redisTemplate,manageAdminService,menuService,manageRoleService));
        return processor;
    }
}
